package messages;


/**
 * PluginOperationFailedMessage
 * 
 * Message sent to the server when some plugin operation (start or stop)
 * failed.
 * This will most likely happen when the plugin doesn't exist, but may
 * also happen if the operation threw an exception.
 */
public class PluginOperationFailedMessage extends Message {

	public enum ErrorCode { UnknownPlugin, OperationFailed, InsufficientPermissions }
	
	public PluginOperationFailedMessage(ErrorCode errorCode, Message originalMessage) {
		super();
	
		this.errorCode = errorCode;
		this.originalMessage = originalMessage;		
	}
			
	
	public ErrorCode getErrorCode() {
		return this.errorCode;
	}


	public Message getOriginalMessage() {
		return this.originalMessage;
	}
	
	
	@Override
	public String toString() {
		return super.toString() + " " + errorCode.toString();
	}
	
	
	private ErrorCode errorCode;				// The error code that explains why request is invalid
	private Message originalMessage;			// The original message sent by the user

	private static final long serialVersionUID = 1L;
}
